package com.iwdnb.gkgz.ui.job;

import java.util.Date;

import cn.hutool.core.date.DateUtil;
import com.iwdnb.gkgz.application.service.StockDayDataSerivce;
import com.iwdnb.job.annotation.Job;
import com.iwdnb.job.handler.BaseJobHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import static com.iwdnb.gkgz.common.utils.WorkTimeUtils.isWorkingTime;

/**
 * 股票今日信息持久化,含涨停板数据持久化
 */
@Slf4j
@Job(cron = "0 10 15,20 * * ?")
public class StockStoreTodayDataJob extends BaseJobHandler {

    @Autowired
    private StockDayDataSerivce stockDayDataSerivce;

    @Override
    public boolean doProcess(String parameter) {
        log.info("StockStoreTodayDataJob begin");
        Date endDate = new Date();
        Date beginDate = DateUtil.offsetDay(endDate, -10);
        stockDayDataSerivce.loadAllStockDayData(DateUtil.formatDate(beginDate),
            DateUtil.formatDate(endDate), true,
            true);
        log.info("StockStoreTodayDataJob end");
        return true;
    }
}
